<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    </script> -->
    <input type="button" id="btn" value="更换颜色" />
    <script>
        //1、绑定点击事件
        //2、随机生成一个RGB的颜色值
        //3、修改body标签的背景色(document.body.style.backgroundColor = 'rgb(1,1,1)')

        function myRandom(min, max) {
            return parseInt(Math.random() * (max - min + 1)) + min;
        }
         document.getElementById("btn").onclick = function(){
            document.body.style.backgroundColor = `rgb(${myRandom(0,255)},${myRandom(0,255)},${myRandom(0,255)})`
         }
      

    </script>
</body>

</html>